<template>
    <view>
        <scroll-view scroll-y="true" class="scroll-y" @scrolltolower="lower">
            <view class="" v-for="item in from">
                <view class="" style="position: relative;">
                    <view class="mingcheng czjz y">
                        <p class="gang spjz">{{item.title}}</p>
                        <p>{{item.readCount}}</p>
                    </view>
                    <image :src="item.picUrl" style="width: 750rpx;height: 400rpx;"></image>
                </view>
                <view class="jieshao spcz">
                    {{item.subtitle}}
                </view>
            </view>
        </scroll-view>

    </view>
</template>

<script>
    export default {
        data() {
            return {
                from: [], //商品数据
                loadSwitch: false,
                page: 1, //起始页
            }
        },
        onLoad() {
            uni.request({
                url: "http://47.91.230.137:8086/wx/topic/list?pag=" + this.page,
                success: (res) => {
                    // console.log(res)
                    this.from = res.data.data.list
                }
            })
        },
        methods: {
            lower() {
                console.log("到底了")
                this.page = this.page + 1
                uni.request({
                    url: "http://47.91.230.137:8086/wx/topic/list?page=" + this.page,
                    success: (res) => {
                        // console.log(res)
                        var arr1 = this.from;
                        var arr2 = this.res.data.data.list;
                        var arr3 = arr1.concat(arr2);
                        this.from = arr3
                    }
                })
            }
        }
    }
</script>

<style>
    .mingcheng {
        position: absolute;
        padding-top: 160rpx;
        width: 100%;

    }

    .mingcheng p {
        font-size: 50rpx;
        color: #ffffff;
    }

    .gang {
        width: 90%;
        border-bottom: #ffffff solid 6rpx;
    }

    .jieshao {
        width: 90%;
        margin: auto;
        font-size: 39rpx;
        padding-top: 30rpx;
        padding-bottom: 40rpx;
    }
</style>